package com.jay.lang.reflect.intf;

import java.lang.ref.Reference;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;

import com.jay.lang.ref.clazz.Bean;

public class GenericArrayTypeIntf {

	public static void main(String[] args) throws NoSuchMethodException,
			SecurityException, ClassNotFoundException {
		Method getPayments = GenericArrayTypeIntf.class.getMethod(
				"getPayments", new Class[] { String[].class, List.class, Reference[].class});
		Type[] types = getPayments.getGenericParameterTypes();
		if (types[2] instanceof GenericArrayType) {
			System.out
					.println("The first parameter of this method is GenericArrayType.");
			GenericArrayType gType = (GenericArrayType) types[2];
			System.out.println(gType.getGenericComponentType());
		}

	}

	public String[] getPayments(String[] payments, List<String> products,
			Reference<Bean>[] refs) {
		return payments;
	}

}
